import 'package:flutter/material.dart';
import 'package:flowerny/model/good.dart';
import 'package:flowerny/page/p_widgets/TravelDestinationContent.dart';
import 'package:flowerny/page/p_tabs/mall/good_detail.dart';

class RewardItem extends StatelessWidget{

  final Good _good;
  ShapeBorder _shape = const RoundedRectangleBorder(
    borderRadius: BorderRadius.only(
      topLeft: Radius.circular(8.0),
      topRight: Radius.circular(8.0),
      bottomLeft: Radius.circular(8.0),
      bottomRight: Radius.circular(8.0),
    ),
  );
  RewardItem(this._good);

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      top: false,
      bottom: false,
      child: Padding(
        padding: const EdgeInsets.all(8.0),
        child: Column(
          children: <Widget>[
            Padding(
              padding: const EdgeInsets.all(2.0),
            ),
            SizedBox(
              height: 220.0,
              child: Card(
                // This ensures that the Card's children (including the ink splash) are clipped correctly.
                clipBehavior: Clip.antiAlias,
                shape: _shape,
                child: InkWell(
                  onTap: () {
                    Navigator.push(context, MaterialPageRoute(builder: (context) {
                      return GoodDetailPage(_good.product_id, _good.product_name);
                    }));
                  },
                  // Generally, material cards use onSurface with 12% opacity for the pressed state.
                  splashColor: Theme.of(context).colorScheme.onSurface.withOpacity(0.12),
                  // Generally, material cards do not have a highlight overlay.
                  highlightColor: Colors.transparent,
                  child: TravelDestinationContent(destination: _good),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }

}